<?xml version="1.0" encoding="UTF-8" ?>
<%@ taglib prefix="zhangyj" uri="http://www.zhangyj.com/input" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
SelectorInfo info = (SelectorInfo) request.getAttribute("selectInfo");
    String param = (String)request.getAttribute("param");
String contextPath = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@page import="com.zhangyj.component.grid.HTMLTable"%>
<%@page import="com.zhangyj.entitis.SelectorInfo"%>
<%@page import="com.zhangyj.component.ToolBar"%>
<%@page import="com.zhangyj.LocalMessage"%>
<%@page import="com.zhangyj.util.Tools"%><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base target="_self">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Seletor---<%=info.getCaption() %></title>
<jsp:include page="/WEB-INF/jsps/include.jsp"></jsp:include>
<%@include file="/WEB-INF/jsps/head.jsp" %>
<script type="text/javascript">

var returnjson =<%=request.getAttribute("returnValJson").toString()%>;
function uf_ok() {
	var returnVals = [];
	var elms = document.getElementsByName("rowno");
	for (var i = 0; i < elms.length; i++) {
		var elm = elms.item(i);
		if(elm.checked) {
			returnVals[returnVals.length] = returnjson[parseInt(elm.value)];
		}
	}
	
	if (returnVals.length < 1) {
		alert("no checked !");
		return;
	}
	
	if (returnVals.length == 1) {
		window.returnValue = returnVals[0];
	} else {
		window.returnValue = returnVals;
	}
	window.close();
}
function uf_query() {
	document.forms["form1"].submit();
}
</script>
</head>

<body>
<form name="form1"action="<%=contextPath %>/selector/<%=info.getName() %>.do" method="post">
<input type="hidden" name="param" value="<%=param %>"/>
<%
	ToolBar toolbar = new ToolBar();
	toolbar.setTitle(info.getCaption());
	toolbar.put(new ToolBar.Item(LocalMessage.get("ok"), "uf_ok()"));
	toolbar.put(new ToolBar.Item(LocalMessage.get("cancel"), "window.close()"));
	if (info.getFilterName() != null) {
		toolbar.put(new ToolBar.Item("<input name='" + info.getFilterName() + "' value='" + Tools.getParameter(request,info.getFilterName()) + "'/>",null));
		toolbar.put(new ToolBar.Item(LocalMessage.get("query"), "uf_query()"));
	}
	toolbar.writer(out);
%>
<%=com.zhangyj.entitis.SystemParam.getSystemParam(request).toInput() %>
</form>
<center>
<%
HTMLTable ht = (HTMLTable)request.getAttribute("table");
ht.println(out); 
%>
<zhangyj:pagnation />
</center>
</body>
</html>